import Vue from 'vue';
import VueRouter from 'vue-router';
// import HomeView from '../views/HomeView.vue'
const login = () => import('../views/login.vue');
const register = () => import('../views/register.vue');
const main = () => import('../layout/main.vue');
const home = () => import('../views/home.vue');
const user = () => import('../views/user.vue');
const truck = () => import('../views/product/truck.vue');
const shovel = () => import('../views/product/shovel.vue');
const Asl = () => import('../views/product/asl.vue');

Vue.use(VueRouter);

const routes = [
  {
    path: '/main',
    name: 'main',
    component: main,
    children: [
      {
        path: '/',
        redirect: '/home',
      },
      {
        path: '/home',
        name: 'home',
        component: home,
      },
      {
        path: '/user',
        name: 'user',
        component: user,
      },
      {
        path: '/truck',
        name: 'truck',
        component: truck,
      },
      {
        path: '/shovel',
        name: 'shovel',
        component: shovel,
      },
      {
        path: '/asl',
        name: 'Asl',
        component: Asl,
      },
    ],
  },
  {
    path: '/login',
    name: 'login',
    component: login,
  },
  {
    path: '/register',
    name: 'register',
    component: register,
  },
  {
    path: '/',
    redirect: '/login',
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
